package com.mocha.common.config;

import javax.servlet.http.HttpServletResponse;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.mocha.interceptor.MyInterceptor;
import com.mocha.service.myService;
@Before(value=MyInterceptor.class)
public class indexController extends Controller {
	public void index(){
		renderJsp("index.jsp");
	}
	
	/**
	 * 测试axios
	 */
	public void m1(){
		String name = getPara("name");
		System.out.println("name:"+name);
		HttpServletResponse response=getResponse();
		response.setContentType("text/json;charset=utf-8");
		renderJson("hello", "hello world");
	}
	
	/**
	 * 使用enhance 对类加强可以使用拦截器
	 */
	public void m2(){
//		myService service = enhance(myService.class);
		myService service  = new myService();
		service.pay(10, 10);
		System.out.println("------------------");
		renderText("请求完成！");
	}
}
